//
//  HelloWorldLayer.m
//  game
//
//  Created by 정수 최 on 12. 10. 25..
//  Copyright __MyCompanyName__ 2012년. All rights reserved.
//


// Import the interfaces
#import "HelloWorldLayer.h"
#import "playPage.h"


// HelloWorldLayer implementation
@implementation HelloWorldLayer

+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	HelloWorldLayer *layer = [HelloWorldLayer node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
    if( (self=[super init]) )
    {
        self.isTouchEnabled = YES;
        CCSprite *Open = [CCSprite spriteWithFile:@"main.png"];
        
        CGSize size = [[CCDirector sharedDirector]winSize];
        Open.position = ccp(size.width /2 , size.height/2);
        
        [self addChild:Open];
	}
	return self;
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc
{
	// in case you have something to dealloc, do it in this method
	// in this particular example nothing needs to be released.
	// cocos2d will automatically release all the children (Label)
	
	// don't forget to call "super dealloc"
	[super dealloc];
}

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    NSLog(@"탭 개수 %d", touch.tapCount);
    if(touch.tapCount == 1)
    {
        [self performSelector:@selector(ChangeScene) withObject:nil afterDelay:1];
        
    }
}

-(void) ChangeScene
{
    [[CCDirector sharedDirector]replaceScene:[CCTransitionPageTurn transitionWithDuration:1 scene:[menuPage scene]]];
}

@end
